//https://leetcode.cn/problems/single-number-ii/description/

class Solution {
public:
    int singleNumber(vector<int>& nums) {
        //1.排序
        sort(nums.begin(), nums.end());
        //双指针
        int left = 0, right = nums.size() - 1;
        while (left < right)
        {
            if (nums[left] == nums[left + 1])
            {
                left += 3;
            }
            if (nums[right] == nums[right - 1])
            {
                right -= 3;
            }

        }

        return nums[left];
    }
};